//
//  GradeCellCollectionViewCell.m
//  fp
//
//  Created by xingshuai on 2020/11/15.
//

#import "GradeCellCollectionViewCell.h"

@interface GradeCellCollectionViewCell ()

@property (nonatomic, strong) UILabel *label;

@end

@implementation GradeCellCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.label = [[UILabel alloc]init];
        self.label.layer.cornerRadius = 15;
        self.label.layer.masksToBounds = YES;
        self.label.layer.borderWidth = 1;
        self.label.layer.borderColor = [UIColor clearColor].CGColor;
        self.label.backgroundColor = [UIColor colorWithHexString:@"#F3F3F3"];
        self.label.textAlignment = NSTextAlignmentCenter;
        self.label.font = [UIFont pingFangSCWithWeight:FontWeightStyleRegular size:16];
        self.label.textColor = [UIColor colorWithHexString:@"#606060"];
        [self.contentView addSubview:self.label];
        [self.label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.center.equalTo(self.contentView);
            make.left.equalTo(self.contentView).offset(15);
            make.right.equalTo(self.contentView).offset(-15);
            make.height.mas_offset(30);
        }];
    }
    return self;
}

-(void)setModel:(GradModel *)model {
    self.label.text = model.gradeString;
    if (model.isSelect) {
        self.label.layer.borderColor = [UIColor colorWithHexString:@"#4E75FF"].CGColor;
        self.label.backgroundColor = [UIColor colorWithHexString:@"#E7F3FF"];
    } else {
        self.label.layer.borderColor = [UIColor clearColor].CGColor;
        self.label.backgroundColor = [UIColor colorWithHexString:@"#F3F3F3"];
    }
}

@end
